Move ptsname module under tools/python.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 5 Mar 2007 18:54:26 +0000 (18:54 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 5 Mar 2007 18:54:26 +0000 (18:54 +0000)
Signed-off-by: Keir Fraser <keir@xensource.com>
tools/Makefile
tools/ptsname/Makefile [deleted file]
tools/ptsname/ptsname.c [deleted file]
tools/ptsname/setup.py [deleted file]
tools/python/ptsname/ptsname.c [new file with mode: 0644]
tools/python/setup.py

index 77ec4376898165aa120b2249221192d1e78727b2..b4156fc90435e496888824aa41c0f68220d939fe 100644 (file)
@@ -26,7 +26,6 @@ SUBDIRS-$(LIBXENAPI_BINDINGS) += libxen
 ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
 SUBDIRS-y += python
 SUBDIRS-y += pygrub
-SUBDIRS-y += ptsname
 endif
 
 .PHONY: all
diff --git a/tools/ptsname/Makefile b/tools/ptsname/Makefile
deleted file mode 100644 (file)
index a1db24c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-
-XEN_ROOT = ../..
-include $(XEN_ROOT)/tools/Rules.mk
-
-.PHONY: all
-all: build
-.PHONY: build
-build:
-       CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py build
-
-.PHONY: install
-ifndef XEN_PYTHON_NATIVE_INSTALL
-install: all
-       CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --home="$(DESTDIR)/usr" --prefix=""
-else
-install: all
-       CC="$(CC)" CFLAGS="$(CFLAGS)" python setup.py install --root="$(DESTDIR)"
-endif
-
-.PHONY: clean
-clean:
-       rm -rf build tmp *.pyc *.pyo *.o *.a *~ a.out
diff --git a/tools/ptsname/ptsname.c b/tools/ptsname/ptsname.c
deleted file mode 100644 (file)
index 3849bb8..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/******************************************************************************
- * ptsname.c
- * 
- * A python extension to expose the POSIX ptsname() function.
- * 
- * Copyright (C) 2007 XenSource Ltd
- */
-
-#include <Python.h>
-#include <stdlib.h>
-
-/* Needed for Python versions earlier than 2.3. */
-#ifndef PyMODINIT_FUNC
-#define PyMODINIT_FUNC DL_EXPORT(void)
-#endif
-
-static PyObject *do_ptsname(PyObject *self, PyObject *args)
-{
-    int fd;
-    char *path;
-
-    if (!PyArg_ParseTuple(args, "i", &fd))
-        return NULL;
-
-    path = ptsname(fd);
-
-    if (!path)
-    {
-        PyErr_SetFromErrno(PyExc_IOError);
-        return NULL;
-    } 
-
-    return PyString_FromString(path);
-}
-
-static PyMethodDef ptsname_methods[] = { 
-    { "ptsname", do_ptsname, METH_VARARGS }, 
-    { NULL }
-};
-
-PyMODINIT_FUNC initptsname(void)
-{
-    Py_InitModule("ptsname", ptsname_methods);
-}
diff --git a/tools/ptsname/setup.py b/tools/ptsname/setup.py
deleted file mode 100644 (file)
index 5fbdfec..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-from distutils.core import setup, Extension
-
-extra_compile_args  = [ "-fno-strict-aliasing", "-Werror" ]
-
-setup(name         = 'ptsname',
-      version      = '1.0',
-      description  = 'POSIX ptsname() function',
-      author       = 'Tim Deegan',
-      author_email = 'Tim.Deegan@xensource.com',
-      license      = 'GPL',
-      ext_modules  = [ Extension("ptsname", [ "ptsname.c" ]) ])
diff --git a/tools/python/ptsname/ptsname.c b/tools/python/ptsname/ptsname.c
new file mode 100644 (file)
index 0000000..3849bb8
--- /dev/null
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * ptsname.c
+ * 
+ * A python extension to expose the POSIX ptsname() function.
+ * 
+ * Copyright (C) 2007 XenSource Ltd
+ */
+
+#include <Python.h>
+#include <stdlib.h>
+
+/* Needed for Python versions earlier than 2.3. */
+#ifndef PyMODINIT_FUNC
+#define PyMODINIT_FUNC DL_EXPORT(void)
+#endif
+
+static PyObject *do_ptsname(PyObject *self, PyObject *args)
+{
+    int fd;
+    char *path;
+
+    if (!PyArg_ParseTuple(args, "i", &fd))
+        return NULL;
+
+    path = ptsname(fd);
+
+    if (!path)
+    {
+        PyErr_SetFromErrno(PyExc_IOError);
+        return NULL;
+    } 
+
+    return PyString_FromString(path);
+}
+
+static PyMethodDef ptsname_methods[] = { 
+    { "ptsname", do_ptsname, METH_VARARGS }, 
+    { NULL }
+};
+
+PyMODINIT_FUNC initptsname(void)
+{
+    Py_InitModule("ptsname", ptsname_methods);
+}
index 7b25025d9d303e1579b5eb907b2c8ca5d3b16854..11ef487203e31914c1120003cf364338a492935c 100644 (file)
@@ -44,7 +44,14 @@ acm = Extension("acm",
                libraries          = libraries,
                sources            = [ "xen/lowlevel/acm/acm.c" ])
 
-modules = [ xc, xs, acm ]
+ptsname = Extension("ptsname",
+               extra_compile_args = extra_compile_args,
+               include_dirs       = include_dirs + [ "ptsname" ],
+               library_dirs       = library_dirs,
+               libraries          = libraries,
+               sources            = [ "ptsname/ptsname.c" ])
+
+modules = [ xc, xs, acm, ptsname ]
 if os.uname()[0] == 'SunOS':
     modules.append(scf)